﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HidesaburoDotNET.Core.Detecctors
{
    public class DaisangenDetector : YakuDetector
    {
        public override Yaku CheckYaku(AgariTehai agariTehai)
        {

            int hakuCount = 0;

            foreach(Hai h in agariTehai.Hai)
            {
                if(h.Type == HaiType.Jihai && h.Number == Hai.Haku)
                {
                    hakuCount++;
                }
            }

            if(hakuCount < 3)
            {
                return new Yaku();
            }
            else
            {

                int hatsuCount = 0;

                foreach(Hai h in agariTehai.Hai)
                {
                    if(h.Type == HaiType.Jihai && h.Number == Hai.Hatsu)
                    {
                        hatsuCount++;
                    }
                }

                if(hatsuCount < 3)
                {
                    return new Yaku();
                }
                else
                {

                    int chunCount = 0;

                    foreach(Hai h in agariTehai.Hai)
                    {
                        if(h.Type == HaiType.Jihai && h.Number == Hai.Chun)
                        {
                            chunCount++;
                        }
                    }

                    if(chunCount < 3)
                    {
                        return new Yaku();
                    }
                    else
                    {
                        return new Yaku(13,"ダイサンゲン");
                    }
                }
            }
        }
    }
}